import shutil
import os

# os.mkdir('./test1')


def copyfile():
    with open('testA.txt', 'w') as f:
        f.write('testA hello world ')

    with open('testB.txt', 'w') as fb:
        fb.write("testB hi thomas")

    shutil.copyfile('testA.txt', './testB.txt', follow_symlinks=True)


def copydirectory():
    shutil.copy('testA.txt', './target1', follow_symlinks=True)

def copyTree():
    shutil.copytree('./source', 'tagert2')


def movedir():
    shutil.move('./source', 'tagert2')


def cddir():
    os.chdir("d://work")
    print("pwd: " + os.getcwd())

def tarbackup():
    shutil.make_archive("mysqlBackup","gztar", "target1")

def unPackArchive():
    shutil.unpack_archive("mysqlBackup.tar.gz", "backup", "gztar")


if __name__ == '__main__':
    unPackArchive()

